package study.函数式接口.函数复合;

import java.util.function.Function;

/**
 * @Author 金贵权
 * @Date 2023/6/16 14:56
 **/
public class Demo01 {
    public static void main(String[] args) {
        Function<Integer,Integer> f = x->x+1;
        Function<Integer,Integer> f2 = y->y*2;
        Function<Integer, Integer> f1 = f.andThen(f2);
        Integer result = f1.apply(1);
        System.out.println(result);

        Function<Integer, Integer> f3 = f.compose(f2);
        Integer result1 = f3.apply(1);
        System.out.println(result1);

    }
}
